package com.ruoyi.develop.lvDuxindetail.service.impl;

import java.util.List;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.DateUtils;
        import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.ruoyi.develop.lvDuxindetail.mapper.LvDuxindetailMapper;
import com.ruoyi.develop.lvDuxindetail.domain.LvDuxindetail;
import com.ruoyi.develop.lvDuxindetail.service.ILvDuxindetailService;

/**
 * 镀锌单明细Service业务层处理
 * @author lmm
 * @date 2025-07-18
 */
@Service
public class LvDuxindetailServiceImpl implements ILvDuxindetailService {
    @Resource
    private LvDuxindetailMapper lvDuxindetailMapper;

    /**
     * 查询镀锌单明细
     * @param id 镀锌单明细主键
     * @return 镀锌单明细
     */
    @Override
    public LvDuxindetail selectById(String id) {
        return lvDuxindetailMapper.selectById(id);
    }

    /**
     * 查询镀锌单明细列表
     * @param entity 镀锌单明细
     * @return 镀锌单明细
     */
    @Override
    public List<LvDuxindetail> selectList(LvDuxindetail entity) {
        return lvDuxindetailMapper.selectList(entity);
    }

    /**
     * 新增镀锌单明细
     * @param entity 镀锌单明细
     * @return 结果
     */
    @Override
    public int insert(LvDuxindetail entity) {
        if(StringUtils.isBlank(entity.getId())){
            entity.setId(IdUtils.fastSimpleUUID());
        }
                entity.setCreateBy(SecurityUtils.getUsername());
                entity.setCreateTime(DateUtils.getNowDate());
            return lvDuxindetailMapper.insert(entity);
    }

    /**
     * 修改镀锌单明细
     * @param entity 镀锌单明细
     * @return 结果
     */
    @Override
    public int update(LvDuxindetail entity) {
                entity.setUpdateBy(SecurityUtils.getUsername());
                entity.setUpdateTime(DateUtils.getNowDate());
        return lvDuxindetailMapper.update(entity);
    }

    /**
     * 批量删除镀锌单明细
     * @param ids 需要删除的镀锌单明细主键
     * @return 结果
     */
    @Override
    public int deleteByIds(String[] ids) {
        return lvDuxindetailMapper.deleteByIds(ids);
    }

    /**
     * 删除镀锌单明细信息
     * @param id 镀锌单明细主键
     * @return 结果
     */
    @Override
    public int deleteById(String id) {
        return lvDuxindetailMapper.deleteById(id);
    }

    @Override
    public int deleteByParentId(String id) {
        return lvDuxindetailMapper.deleteByParentId(id);
    }
}
